<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "custom".
 *
 * @property integer $c_id
 * @property string $c_name
 * @property string $c_pass
 * @property string $myname
 * @property string $phone
 * @property string $email
 * @property string $dl_data
 * @property string $zc_data
 * @property string $money
 *
 * @property Address[] $addresses
 * @property Gouwuche[] $gouwuches
 * @property Orders[] $orders
 */
class Custom extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'custom';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['c_id', 'c_name', 'c_pass', 'myname', 'phone', 'email', 'dl_data', 'zc_data'], 'required'],
            [['c_id'], 'integer'],
            [['phone', 'money'], 'number'],
            [['dl_data', 'zc_data'], 'safe'],
            [['c_name', 'c_pass', 'myname', 'email'], 'string', 'max' => 30]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'c_id' => '会员ID',
            'c_name' => '名称',
            'c_pass' => '密码',
            'myname' => '真实姓名',
            'phone' => '手机号',
            'email' => '邮箱',
            'dl_data' => '详细信息',
            'zc_data' => 'Zc Data',
            'money' => '余额',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getAddresses()
    {
        return $this->hasMany(Address::className(), ['c_id' => 'c_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getGouwuches()
    {
        return $this->hasMany(Gouwuche::className(), ['c_id' => 'c_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getOrders()
    {
        return $this->hasMany(Orders::className(), ['c_id' => 'c_id']);
    }
}
